package com.huawei.appgallery.updatemanager.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.PullUpListView;
import com.huawei.appgallery.updatemanager.ui.cardkit.node.NoUpdateDataNode;
import o.czk$c;

public class UpdateListView extends PullUpListView {
    public UpdateListView(Context context) {
        super(context);
    }

    public UpdateListView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public UpdateListView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        if (z) {
            ᐝॱ();
        }
    }

    public void handleDataChanged() {
        super.handleDataChanged();
        ᐝॱ();
    }

    private void ᐝॱ() {
        int childCount = getChildCount();
        int height = getHeight();
        View view = null;
        int i = 0;
        int i2 = 0;
        int i3 = 0;
        while (i < childCount) {
            int i4;
            View childAt = getChildAt(i);
            if (childAt != null) {
                Object tag = childAt.getTag();
                if (tag == null || !(tag instanceof NoUpdateDataNode)) {
                    View view2 = view;
                    i4 = i2;
                    i2 = childAt.getHeight() + i3;
                    childAt = view2;
                } else {
                    view = childAt.findViewById(czk$c.ॱͺ);
                    if (view != null) {
                        i4 = view.getMinimumHeight();
                        i2 = i3;
                    } else {
                        i4 = i2;
                        i2 = i3;
                    }
                }
            } else {
                childAt = view;
                i4 = i2;
                i2 = i3;
            }
            i++;
            i3 = i2;
            i2 = i4;
            view = childAt;
        }
        if (view != null) {
            i3 = height - i3;
            LayoutParams layoutParams = view.getLayoutParams();
            if (layoutParams == null) {
                layoutParams = new LinearLayout.LayoutParams(-1, i2);
            }
            if (i3 > i2) {
                layoutParams.height = i3;
            } else {
                layoutParams.height = i2;
            }
            view.setLayoutParams(layoutParams);
        }
    }
}
